﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminPanel/AdminSite.Master" AutoEventWireup="true" CodeBehind="SupervisorFullView.aspx.cs" Inherits="FastTrackCabService.AdminPanel.SupervisorFullView" %>
<%@ Import Namespace="BusinessLogicLayer" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../Style/FullView.css" rel="stylesheet" type="text/css"/>
    <link href="../Style/Supervisors.css" rel="stylesheet" type="text/css"/>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:DetailsView ID="DetailsView1" CssClass="detailsView" runat="server"
                     Height="50px" Width="125px"
                     AutoGenerateRows="False" CellPadding="4" ForeColor="#333333"
                     GridLines="None" HeaderText="Supervisor details"
                     AutoGenerateEditButton='<%# Roles.GetRolesForUser(User.Identity.Name).Contains("Manager") %>' onmodechanging="DetailsView1_ModeChanging">
        <AlternatingRowStyle BackColor="White" ForeColor="#284775"/>
        <CommandRowStyle BackColor="#E2DED6" Font-Bold="True"/>
        <EditRowStyle BackColor="#999999"/>
        <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True"/>
        <Fields>
            <asp:BoundField DataField="StaffId" ReadOnly="True" HeaderText="Staff Id"/>
            <asp:BoundField DataField="FirstName" HeaderText="First Name"/>
            <asp:BoundField DataField="LastName" HeaderText="Last Name"/>
            <asp:BoundField DataField="EMail" HeaderText="E-Mail"/>
            <asp:BoundField DataField="TelephoneNo" HeaderText="Telephone No"/>
            <asp:BoundField DataField="Address" HeaderText="Address"/>
            <asp:TemplateField HeaderText="Subsidiary Id">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# CityBLL.GetCityById(SubsidiaryBLL.GetCityIdBySubsidiaryId(Convert.ToByte(Eval("SubsidiaryId")))).Name %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="SupervisorType" HeaderText="Supervisor Type"/>
        </Fields>
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"/>
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333"/>
    </asp:DetailsView>


    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <h2 style="color: #5D7B9D; font-family: Tahoma; margin-bottom: 0.5em; margin-top: 1.5em;">Vehicles under supervision</h2>
            <table style="margin: auto; margin-bottom: 1.5em;">
                <tr>
                    <td>
                        <div class="searchBox">
                            <asp:TextBox ID="tbSearch" runat="server" MaxLength="10" placeholder="Search by registration no"
                                         CssClass="myTextBox">
                            </asp:TextBox>
                            <asp:ImageButton ID="ibtnSearch" runat="server" OnClick="ibtnSearch_OnClick"
                                             ImageUrl="~/Images/magnifying_glass_icon.png">
                            </asp:ImageButton>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:GridView ID="gvVehicles" CssClass="supervisors" runat="server" CellPadding="4"
                                      ForeColor="#333333" GridLines="None" AllowPaging="True" AutoGenerateColumns="False"
                                      OnPageIndexChanging="gvVehicles_OnPageIndexChanging">
                            <AlternatingRowStyle BackColor="White" ForeColor="#284775"/>
                            <Columns>
                                <asp:BoundField DataField="RegistrationNo" HeaderText="Registration No"/>
                                <asp:BoundField DataField="Type" HeaderText="Type"/>
                                <asp:TemplateField HeaderText="Action">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="ibView" ToolTip="Edit this vehicle" PostBackUrl='<%# "EditVehicleForm.aspx?regNo=" + Eval("RegistrationNo") %>'
                                                         ImageUrl="../Images/edit.png" runat="server">
                                        </asp:ImageButton>
                                        <asp:ImageButton OnClick="ibDelete_OnClick" ID="ibDelete" OnClientClick=" if (!confirm('Are you sure do you want to remove this vehicle?\nAll records related to this vehicle also will be delete!\nThis cannot be undone!')) return false; "
                                                         ToolTip="Remove this vehicle" PostBackUrl='<%# "?RegNo=" + Server.UrlEncode(Eval("RegistrationNo").ToString()) %>'
                                                         ImageUrl="../Images/delete-black.png" runat="server">
                                        </asp:ImageButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <EmptyDataRowStyle CssClass="emptyDataRow"></EmptyDataRowStyle>
                            <EmptyDataTemplate>
                                <table class="supervisors" id="ContentPlaceHolder1_gvVehicles" style="border-collapse: collapse; color: #333333; width: 500px;">
                                    <tr style="background-color: #5D7B9D; color: White; font-weight: bold;">
                                        <th scope="col">
                                            Registration No
                                        </th>
                                        <th scope="col">
                                            Subsidiary
                                        </th>
                                        <th scope="col">
                                            Supervisor
                                        </th>
                                        <th scope="col">
                                            Type
                                        </th>
                                        <th scope="col">
                                            Action
                                        </th>
                                    </tr>
                                    <tr style="background-color: #F7F6F3; color: #333333;">
                                        <td colspan="5" style="padding: 0.5em;">
                                            NO VEHICLE AVAILABLE
                                        </td>
                                    </tr>
                                </table>
                            </EmptyDataTemplate>
                            <EditRowStyle BackColor="#999999"/>
                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"/>
                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333"/>
                            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333"/>
                            <SortedAscendingCellStyle BackColor="#E9E7E2"/>
                            <SortedAscendingHeaderStyle BackColor="#506C8C"/>
                            <SortedDescendingCellStyle BackColor="#FFFDF8"/>
                            <SortedDescendingHeaderStyle BackColor="#6F8DAE"/>
                        </asp:GridView>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>